package cn.yh.register.order.receiver;

import cn.yh.register.common.constant.MqConst;
import cn.yh.register.order.service.OrderService;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class OederReceiver {

    @Autowired
    OrderService orderService;

    @RabbitListener(bindings = @QueueBinding(
            exchange = @Exchange(name = MqConst.EXCHANGE_DIRECT_TASK),
            value = @Queue(name = MqConst.QUEUE_TASK_8, durable = "true"),
            key = MqConst.ROUTING_TASK_8
    ))
    public void receive(Message message, Channel channel) {
        System.out.println("接收到消息" );
        // 发送就诊提醒
        orderService.patientTips();

    }

}
